package com.chaoyong.higo.activity;

import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.Toast;

import com.chaoyong.higo.R;
import com.chaoyong.higo.base.BaseActivity;
import com.chaoyong.higo.utils.V;
import com.chaoyong.higo.view.TitleView;

public class HuichaoPayActivity extends BaseActivity {

	private Activity context;
	private TitleView imagdet_title;
	private ImageButton imagedet_imgbt;
	private WebView imagdet_webView;
	private String url;
	
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub

	}

	@Override
	public int layoutResID() {
		// TODO Auto-generated method stub
		return R.layout.activity_imag_detail;
	}

	@Override
	public void findView() {
		// TODO Auto-generated method stub
		imagdet_title=V.f(this,R.id.imagdet_title);
		imagdet_webView=V.f(this, R.id.imagdet_webView);
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
		context=this;
		
		url = getIntent().getStringExtra("url");
		//Toast.makeText(context, url, 0).show();
		
		//detail=getIntent().getStringExtra("info");
		imagdet_title.setTitleText("汇潮支付", context.getResources().getColor(R.color.home_text));
		imagdet_title.setLeftImage(R.drawable.back_red);
		imagdet_title.setonLeftClinck(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
		
		WebSettings web = imagdet_webView.getSettings();  
        /*webSettings.setSupportZoom(true);  
        
        webSettings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
		webSettings.setDisplayZoomControls(true);
        
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);  
        webSettings.setBuiltInZoomControls(true);*/
        //imagdet_webView.loadData(detail,"text/html;charset=UTF-8", null);
		//webSettings.setJavaScriptEnabled(true);
		//webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
		//webSettings.setAllowFileAccess(true);// 设置允许访问文件数据
		//webSettings.setSupportZoom(true);
		//webSettings.setBuiltInZoomControls(true);
		//webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
		//webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
		//webSettings.setDomStorageEnabled(true);
		//webSettings.setDatabaseEnabled(true);
		
		
		
		//imagdet_webView.setWebChromeClient(new WebChromeClient());
		
		
		
		//支持javascript
		web.setJavaScriptEnabled(true); 
		
		web.setJavaScriptCanOpenWindowsAutomatically(true);
		
		// 设置可以支持缩放 
		web.setSupportZoom(true); 
		// 设置出现缩放工具 
		//web.setBuiltInZoomControls(true);
		//扩大比例的缩放
		//web.setUseWideViewPort(true);
		//自适应屏幕
		//web.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
		//web.setLoadWithOverviewMode(true);
		
		imagdet_webView.setWebViewClient(new WebViewClient(){
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				// TODO Auto-generated method stub
				view.loadUrl(url);
				return true;
			}
		});
		
		imagdet_webView.loadUrl(url);
	}

}
